package domain

import (
	"vrcm/src/vrcm/common/models"
)

type BackSourceConfig struct {
	models.Model

	TenantId       string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DomainId       int    `json:"domain_id" gorm:"type:bigint unsigned;comment:域名配置id"`
	Protocol       int    `json:"protocol" gorm:"type:tinyint;comment:回源协议 1 http 2https 3follow"`
	EnableHost     int    `json:"enable_host" gorm:"type:tinyint;comment:1启用 2禁用"`
	EnableTrace    int    `json:"enable_trace" gorm:"type:tinyint;comment:回源跟随301/302配置"`
	Host           string `json:"host" gorm:"type:varchar(100);comment:回源host"`
	Area           string `json:"area" gorm:"type:varchar(100);comment:回源区域"`
	OriginTimeout  int    `json:"origin_timeout" gorm:"type:varchar(100);comment:回源超时时间 5-60秒"`
	Ipv6Accelerate string `json:"ipv6_accelerate" gorm:"type:varchar(50);comment:ipv6设置 on 开启 off关闭"`
	models.ModelTime
	models.ControlBy
}

func (BackSourceConfig) TableName() string {
	return "back_source_config"
}

func (e *BackSourceConfig) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *BackSourceConfig) GetId() interface{} {
	return e.Id
}

type HeaderConfig struct {
	models.Model

	TenantId     string `json:"tenant_id" gorm:"type:varchar(50);comment:租户"`
	DomainId     int    `json:"domain_id" gorm:"type:bigint unsigned;comment:域名配置id"`
	HeaderKey    string `json:"header_key" gorm:"type:varchar(100);comment:请求头"`
	HeaderValue  string `json:"header_value" gorm:"type:varchar(100);comment:请求头的值"`
	OperatorType string `json:"operator_type" gorm:"type:varchar(20);comment:操作类型"`
	HeaderType   int    `json:"header_type" gorm:"type:tinyint;comment:1 request 2 response"`
	models.ModelTime
	models.ControlBy
}

func (HeaderConfig) TableName() string {
	return "header_config"
}
